import request from '../../../components/Request';
import {getCfgObj} from '../../components/Cfg/LayoutCfg';
export async function getUserCfg() {
  let result = await request.post({
    url: './settings/getUserCfg.do',
  });
  return result.data;
}

export async function listLayoutCfg() {
  let result = await request.post({
    url: './settings/listLayoutCfg.do',
  });

  return getCfgObj(result.data);
}

export async function getSecurityCfg() {
  let result = await request.post({
    url: './settings/getSecurityCfg.do',
  });
  return result.data;
}

export async function saveUserCfg(data) {
  await request.post({
    url: './settings/saveUserCfg.do',
    data: data,
  });
}

export async function saveLayoutCfg(data) {
  await request.post({
    url: './settings/saveLayoutCfg.do',
    data: data,
    contentType: request.CONTENT_TYPE_JSON,
  });
}

export async function restoreDefaultLayoutCfg(data) {
  await request.post({
    url: './settings/restoreDefaultLayoutCfg.do',
  });
}
